<!--
 * @name: 公共底部组件
 * @version: 1.1.1
 * @Author: 刘大可
 * @Date: 2022-02-11 17:50:12
 * @LastEditors: 刘大可
 * @LastEditTime: 2023-09-07 18:50:43
-->
<template>
  <view class="footer flex">
    <block v-for="(item, index) in tabBar" :key="index">
      <view class="item flex" :class="flg == item.text ? 'cur' : ''" @click="go(item)" :style="style">
        <image class="icon" :src="flg == item.text ? item.selectedIconPath : item.iconPath" mode="scaleToFill" />
        {{ item.text }}
      </view>
    </block>
  </view>
</template>
<script>
export default {
  data() {
    return {
      tabBar: [

        {
          "pagePath": "/uni_modules/school-history/pages/grab/index",
          "iconPath": "/static/tabbar/home.png",
          "selectedIconPath": "/static/tabbar/home_s.png",
          "text": "抢单大厅"
        },
        // {
        //   "pagePath": "/uni_modules/school-history/pages/grab",
        //   "iconPath": "/static/tabbar/order.png",
        //   "selectedIconPath": "/static/tabbar/order_s.png",
        //   "text": "历史接单"
        // },
        {
          "pagePath": "/uni_modules/school-history/pages/mygrab/index",
          "iconPath": "/static/tabbar/my.png",
          "selectedIconPath": "/static/tabbar/my_s.png",
          "text": "我的接单"
        }
        // {
        //     pagePath:"/pages/tabBar/index/index",
        //     text:"首页",
        //     iconPath:"/static/icon/tabBar/icon1.png",
        //     selectedIconPath:"/static/icon/tabBar/icon1_active.png"
        // },
        // {
        //     pagePath:"/pages/tabBar/product/product",
        //     text:"产品",
        //     iconPath:"/static/icon/tabBar/icon2.png",
        //     selectedIconPath:"/static/icon/tabBar/icon2_active.png"
        // },
        // {
        //     pagePath:"/pages/tabBar/shopCar/shopCar",
        //     text:"购物车",
        //     iconPath:"/static/icon/tabBar/icon3.png",
        //     selectedIconPath:"/static/icon/tabBar/icon3_active.png"
        // },
        // {
        //     pagePath:"/pages/tabBar/me/me",
        //     text:"我的",
        //     iconPath:"/static/icon/tabBar/icon4.png",
        //     selectedIconPath:"/static/icon/tabBar/icon4_active.png"
        // }
      ],
      style: `
                width: 50%;
            `
    }
  },
  props: {
    flg: {
      type: String,
    },
    // sys: {
    //     type: object,
    // }
  },
  created() {
    // uni.hideTabBar({
    //     animation:true
    // })
    let sys = uni.getStorageSync('sys')
    let articles_switch = sys.index_articles_switch
    console.log(sys);
    // articles_switch=0
    if (articles_switch == 1) {
      // this.tabBar = [
      //   this.tabBar[0],
      //   {
      //     "pagePath": "/gc_school/pages/article/index",
      //     "iconPath": "/static/tabbar/quanzi.png",
      //     "selectedIconPath": "/static/tabbar/quanzi_s.png",
      //     "text": "圈子"
      //   },
      //   this.tabBar[1],
      //   this.tabBar[2]
      // ]
      // this.style = `
      //          width: 25%;
      //      `
    }
    console.log(articles_switch);
  },
  methods: {
    go(item) {
      // // uni.switchTab({ url: item.pagePath })
      // uni.redirectTo({
      //      url: item.pagePath 
      // });
      // uni.redirectTo({ url: '/pages/' })
      uni.navigateTo({
        url: item.pagePath
      });
    }
  }
}
</script>
<style lang="scss">
@import "./main.scss";
</style>